package org.fujay.langchain4jserver.domain.knowledge.exception;

import org.fujay.langchain4jserver.domain.knowledge.vo.FileId;

/**
 * @author slm
 * @description
 */
public class KnowledgeFileNotFoundException extends RuntimeException {

    private static final String MESSAGE_TEMPLATE = "未找到 ID 为 [%s] 的文件。";

    public KnowledgeFileNotFoundException(FileId fileId) {
        super(String.format(MESSAGE_TEMPLATE, fileId != null ? fileId.value() : "<null>"));
    }

    public KnowledgeFileNotFoundException(FileId fileId, String message) {
        super(
                message != null
                        ? message
                        : String.format(MESSAGE_TEMPLATE, fileId != null ? fileId.value() : "<null>"));
    }

    public KnowledgeFileNotFoundException(FileId fileId, Throwable cause) {
        super(String.format(MESSAGE_TEMPLATE, fileId != null ? fileId.value() : "<null>"), cause);
    }

    public KnowledgeFileNotFoundException(FileId fileId, String message, Throwable cause) {
        super(
                message != null
                        ? message
                        : String.format(MESSAGE_TEMPLATE, fileId != null ? fileId.value() : "<null>"),
                cause);
    }
}
